package com.mingqi.enetconnected.view.Dialog.tree;

import android.content.Context;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mingqi.enetconnected.R;

import java.util.List;

/**
 * @author yaxi
 * @date 2018/9/17
 */
public class ContentAdapter extends BaseQuickAdapter<IDynamicTreeData,BaseViewHolder> {

    private Context mContext;

    public ContentAdapter(Context context , @Nullable List<IDynamicTreeData> data) {
        super(R.layout.item_popup,data);
        mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, IDynamicTreeData item) {
        helper.setText(R.id.item_popup_left,item.getShowLeft());
        if (item.getTreeSelected()){
            helper.setTextColor(R.id.item_popup_left,mContext.getResources().getColor(R.color.colorPrimary));
            helper.setTextColor(R.id.item_popup_right,mContext.getResources().getColor(R.color.colorPrimary));
        }else {
            helper.setTextColor(R.id.item_popup_left,mContext.getResources().getColor(R.color.color_black_ff333333));
            helper.setTextColor(R.id.item_popup_right,mContext.getResources().getColor(R.color.color_black_ff333333));
        }
        if (item.isLastLevel()){
            helper.setText(R.id.item_popup_right,item.getShowRight());
        }else {
            helper.setText(R.id.item_popup_right,"");
        }

    }
}
